// -----------------------------------------------------------------------
//  <copyright file="IEventSourcedStore.cs" company="LiuliuSoft">
//      Copyright (c) 2022-2023 DaprPlus. All rights reserved.
//  </copyright>
//  <site>https://www.dapr.plus</site>
//  <last-editor>郭明锋</last-editor>
//  <last-date>2023-12-16 22:28</last-date>
// -----------------------------------------------------------------------

namespace DaprPlus.Domain.Entity;

/// <summary>
/// 事件溯源信息存储
/// </summary>
public interface IEventSourcedStore
{
    /// <summary>
    /// 保存事件
    /// </summary>
    /// <param name="entityId">实体ID</param>
    /// <param name="events">事件列表</param>
    Task SaveEvents<TKey>(TKey entityId, IEnumerable<DomainEvent> events);

    /// <summary>
    /// 获取聚合根的事件列表
    /// </summary>
    /// <param name="entityId">实体ID</param>
    /// <returns>事件列表</returns>
    Task<List<DomainEvent>> GetEventsForEntity<TKey>(TKey entityId);
}
